package com.jackiechan.day12;

import java.io.*;

public class Test_Stream {
    public static void main(String[] args) throws IOException {
        method();
    }

    public static void method() throws IOException {
        File file;
        file = new File("D:\\stream");
        file.mkdir();
        file = new File("D:\\Stream\\test.txt");
        file.createNewFile();
        InputStream input = new BufferedInputStream(
                new FileInputStream(
                        new File("D:\\Stream\\test.txt")));
        OutputStream output = new BufferedOutputStream(
                new FileOutputStream(
                        new File("D:\\stream\\test.txt")));
        byte[] out = {'M','y',' ','i','d','o','l',' ','i','s',' ',
                'J','a','c','k','i','e',' ','C','h','a','n','!'};
        output.write(out);
        output.close();
        int i=0;
        while((i=input.read())!=-1){
            System.out.print(i+" ");
        }
        input.close();
    }

}
